package com.tml.service.impl;

import com.tml.dao.SmbmsUserDao;

import com.tml.entry.SmbmsUser;
import com.tml.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("loginService")
public class LoginServiceImpl implements LoginService{
    @Autowired
    SmbmsUserDao smbmsUserDao;
    @Override
    public boolean login(String userCode, String userPassword) {
        System.out.println(userCode);
        System.out.println(userPassword);
        //SmbmsUserDao smbmsUserDao =new SmbmsUserDaoImpl();
        //SmbmsUser smbmsUser=smbmsUserDao.getSmbmsUserByUserCode(userCode);
       //SqlSession sqlSession= MybatisUtils.getSqlSession();
       //SmbmsUserDao smbmsUserDao = sqlSession.getMapper(SmbmsUserDao.class);
       SmbmsUser smbmsUser= smbmsUserDao.getSmbmsUserByUserCode(userCode);
       //MybatisUtils.closeSqlSession(sqlSession);
        if(smbmsUser!=null){
            if(userPassword.equals(smbmsUser.getUserPassword())){
                return true;

            }else {return false;}

        }else {return false;}

    }
}
